package com.his.benchwork.service.Imp;

import com.his.benchwork.dao.BenchWorkConfigMapper;
import com.his.benchwork.entity.BenchWorkConfig;
import com.his.benchwork.service.BenchWorkConfigService;
import com.his.benchwork.vo.BenchWorkConfigVo;
import com.xiao.common.util.BeanUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BenchWorkConfigServiceImpl implements BenchWorkConfigService {

    @Resource
    private BenchWorkConfigMapper benchWorkConfigMapper;

    @Override
    public void insertBenchWorkConfig(BenchWorkConfigVo benchWorkConfigVo) {
        BenchWorkConfig benchWorkConfig = BeanUtil.copyBean(benchWorkConfigVo, BenchWorkConfig.class);
        benchWorkConfigMapper.save_bwconfig(benchWorkConfig);
    }

    @Override
    public void deleteBenchWorkConfig(BenchWorkConfigVo benchWorkConfigVo) {
        BenchWorkConfig benchWorkConfig = BeanUtil.copyBean(benchWorkConfigVo, BenchWorkConfig.class);
        benchWorkConfigMapper.delete_bwconfig(benchWorkConfig.getBenchid(),benchWorkConfig.getConfigid());
    }

    @Override
    public List<BenchWorkConfig> selectBenchWorkConfigList(BenchWorkConfigVo benchWorkConfigVo) {
        return benchWorkConfigMapper.select_bwconfig_list(benchWorkConfigVo.getBenchid());
    }

    @Override
    public BenchWorkConfig select_bwconfig(BenchWorkConfigVo benchWorkConfigVo) {
        return benchWorkConfigMapper.select_bwconfig(benchWorkConfigVo.getBenchid(),benchWorkConfigVo.getConfigid());
    }
}
